Component({
    properties: {
        top: {
            type: null
        },
        type: {
            type: null
        },
        start: {
            type: null
        },
        end: {
            type: null
        }
    },
    data: {
        date_obj_arr: [],
        m_index: 8888,
        d_index: 9999
    },
    lifetimes: {
        attached: function() {
            this.getData();
        },
        moved: function() {},
        detached: function() {}
    },
    attached: function() {},
    ready: function() {},
    pageLifetimes: {
        show: function() {},
        hide: function() {},
        resize: function() {}
    },
    methods: {
        getData: function() {
            var t = this, e = this.getMonthsArr(), n = new Date().getMonth() + 1 < 10 ? "0" + (new Date().getMonth() + 1) : new Date().getMonth() + 1 + "", a = new Date().getDate();
            e.forEach(function(e) {
                for (var o = t.getMonthDay(e.year, e.month), i = [], r = [], h = new Date(e.full).getDay(), l = 0; l < o; l++) {
                    var s = {};
                    s.all_date = e.full + "-".concat(l + 1), a == l + 1 && n == e.month ? s.value = "今天" : s.value = l + 1, 
                    a > s.value && n == e.month ? s.isOld = "-1" : a < s.value && n == e.month ? s.isOld = "1" : n == e.month ? s.isOld = "0" : s.isOld = "1", 
                    i.push(s);
                }
                for (var u = 0; u < h; u++) r.push("null");
                e.null = r, e.day = i;
            }), this.setData({
                date_obj_arr: e
            });
        },
        getMonthDay: function(t, e) {
            return new Date(t, e, 0).getDate();
        },
        getMonthsArr: function() {
            var t = [], e = new Date(), n = e.getFullYear(), a = {};
            a.year = n.toString(), a.month = e.getMonth() + 1 < 10 ? "0" + (e.getMonth() + 1) : e.getMonth() + 1 + "", 
            a.full = a.year + "-" + a.month;
            for (var o = 0; o < 11; o++) {
                e.setDate(1), e.setMonth(e.getMonth() + 1);
                var i = {};
                i.year = e.getFullYear().toString(), i.month = e.getMonth() + 1 < 10 ? "0" + (e.getMonth() + 1) : e.getMonth() + 1 + "", 
                i.full = i.year + "-" + i.month, t.push(i);
            }
            return t.unshift(a), t;
        },
        close: function() {
            this.triggerEvent("close", this.data.type);
        },
        chooseDate: function(t) {
            var e = t.currentTarget.dataset.index, n = t.currentTarget.dataset.dayindex, a = t.currentTarget.dataset.alldate;
            this.toggle(e, n), this.triggerEvent("timeChange", {
                type: this.data.type,
                date: a
            });
        },
        toggle: function(t, e, n) {
            this.data.m_index == t && this.data.d_index == e || this.setData({
                m_index: t,
                d_index: e
            });
        }
    }
});